import {
  saleRestrictOptions,
  packageLayersOptions,
  skuOriginalOptions,
  SELL_WELL_OPTIONS
} from './skuOptionsList';
import { IS_NATION_STANDARD_OPTIONS } from '@/constants/commodity';
export const singleAddSkuInfoColumnsFn = (data) => {
  let {
    handleChooseMainUnit,
    handleChooseOriginalPlace
  } = data;
  let columns = [
    {
      title: '品类',
      key: 'categoryPath',
      align: 'center',
      width: 150
    },
    {
      title: 'SPU编码',
      key: 'spuNo',
      align: 'center',
    },
    {
      title: 'SKU编码',
      key: 'skuNo',
      align: 'center',
    },
    {
      title: '商品名称',
      key: 'productNameFinal',
      align: 'center',
    },
    {
      title: '规格',
      align: 'center',
      key: 'specDetailStr',
    },
    {
      title: '是否国标',
      key: 'nationalStandard',
      required: true,
      type: 'select',
      options: IS_NATION_STANDARD_OPTIONS,
      width: 160
    },
    {
      title: '是否畅销',
      key: 'sellWellFlag',
      type: 'select',
      options: SELL_WELL_OPTIONS,
      width: 160
    },
    {
      title: '安全率上限',
      required: true,
      key: 'safeRateUpperLimit',
    },
    {
      title: '安全率下限',
      required: true,
      key: 'safeRateLowerLimit',
    },
    {
      title: '商品条形码',
      align: 'center',
      key: 'barcode',
      type: 'input',
      width: 160
    },
    {
      title: '最小起售量',
      required: true,
      align: 'center',
      key: 'saleMin',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '销售限制类型',
      required: true,
      key: 'saleRestrict',
      align: 'center',
      type: 'select',
      options: saleRestrictOptions,
      width: 160
    },
    {
      title: '商品信息备注',
      key: 'skuRemark',
      type: 'inputHasMaxLength',
      width: 160,
      maxlength: 500
    },
    {
      title: '包装清单',
      required: true,
      key: 'packageContents',
      type: 'inputHasMaxLength',
      width: 160,
      maxlength: 200
    },
    {
      title: '产地',
      required: true,
      width: 160,
      render: (h, { row, index }) => {
        return (
          <el-input
            prefix-icon="el-icon-search"
            readonly
            value={ row.producingAreaName }
            onFocus={ () => { handleChooseOriginalPlace({ index }) } }
          />
        )
      }
    },
    {
      title: 'Sku来源',
      required: true,
      key: 'skuSource',
      width: 160,
      type: 'select',
      options: skuOriginalOptions,
    },
    {
      title: '来源详情',
      key: 'skuSourceDesc',
      type: 'input',
      width: 160
    },
    {
      title: '件装数量',
      required: true,
      align: 'center',
      key: 'pieceInfo',
      type: 'input',
      width: 160
    },
    {
      title: '层数',
      key: 'packageLayers',
      align: 'center',
      type: 'select',
      options: packageLayersOptions,
      width: 160
    },
    {
      title: '单品包装单位',
      key: 'singlePackageUnit',
      align: 'center'
    },
    {
      title: '单品数量',
      align: 'center',
      key: 'singlePackageCount',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '单品最长边(cm)',
      align: 'center',
      key: 'singleEdge1',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '单品次长边(cm)',
      align: 'center',
      key: 'singleEdge2',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '单品最短边(cm)',
      align: 'center',
      key: 'singleEdge3',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '单品体积(m³)',
      align: 'center',
      key: 'singleVolume',
    },
    {
      title: '单品重量(kg)',
      align: 'center',
      key: 'singleWeight',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '一层包装单位',
      align: 'center',
      key: 'onePackageUnit',
      width: 160,
      render: (h, { row, index }) => {
        return (
          <el-input
            prefix-icon="el-icon-search"
            readonly
            value={ row.onePackageUnit }
            onFocus={ () => { handleChooseMainUnit({ type: 'onePackageUnit', index }) } }
          />
        )
      }
    },
    {
      title: '一层数量',
      align: 'center',
      key: 'onePackageCount',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '一层最长边(cm)',
      align: 'center',
      key: 'oneEdge1',
      type: 'inputNumChange',
      width: 160
    }, {
      title: '一层次长边(cm)',
      align: 'center',
      key: 'oneEdge2',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '一层最短边(cm)',
      align: 'center',
      key: 'oneEdge3',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '一层体积(m³)',
      align: 'center',
      key: 'oneVolume',
    },
    {
      title: '一层重量(kg)',
      align: 'center',
      key: 'oneWeight',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '二层包装单位',
      align: 'center',
      key: 'twoPackageUnit',
      width: 160,
      render: (h, { row, index }) => {
        return (
          <el-input
            prefix-icon="el-icon-search"
            readonly
            value={ row.twoPackageUnit }
            onFocus={ () => { handleChooseMainUnit({ type: 'twoPackageUnit', index }) } }
          />
        )
      }
    },
    {
      title: '二层数量',
      align: 'center',
      key: 'twoPackageCount',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '二层最长边(cm)',
      align: 'center',
      key: 'twoEdge1',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '二层次长边(cm)',
      align: 'center',
      key: 'twoEdge2',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '二层最短边(cm)',
      align: 'center',
      key: 'twoEdge3',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '二层体积(m³)',
      align: 'center',
      key: 'twoVolume',
    },
    {
      title: '二层重量(kg)',
      align: 'center',
      key: 'twoWeight',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '三层包装单位',
      align: 'center',
      key: 'threePackageUnit',
      width: 160,
      render: (h, { row, index }) => {
        return (
          <el-input
            prefix-icon="el-icon-search"
            readonly
            value={ row.threePackageUnit }
            onFocus={ () => { handleChooseMainUnit({ type: 'threePackageUnit', index }) } }
          />
        )
      }
    },
    {
      title: '三层数量',
      align: 'center',
      key: 'threePackageCount',
      type: 'inputSpecialNum',
      width: 160
    },
    {
      title: '三层最长边(cm)',
      align: 'center',
      key: 'threeEdge1',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '三层次长边(cm)',
      align: 'center',
      key: 'threeEdge2',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '三层最短边(cm)',
      align: 'center',
      key: 'threeEdge3',
      type: 'inputNumChange',
      width: 160
    },
    {
      title: '三层体积(m³)',
      key: 'threeVolume',
      align: 'center',
    },
    {
      title: '三层重量(kg)',
      align: 'center',
      key: 'threeWeight',
      type: 'inputSpecialNum',
      width: 160
    }
  ]
  return columns
}
